package com.wzy.service;

import com.wzy.dao.UserDao;
import com.wzy.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserDao userDao;
    public List<User> find(){
        return userDao.findAll();
    }
    public int save(User user)
    {
        if(user.getId()==null)
        {
            return userDao.insert(user);
        }
        else{
            return userDao.update(user);
        }
    }
    public int delete(User user)
    {
        return userDao.delete(user);
    }

}
